<template>
    <h2>登录页面</h2>
    <table>
        <tr>
            <td>用户名</td>
            <td><input type="text" v-model="info.Uname"></td>
        </tr>
        <tr>
            <td>密码</td>
            <td><input type="password" v-model="info.Upwd"></td>
        </tr>
        <tr>
            <td colspan="2">
                <button @click="Ulogin">登录</button>
            </td>
        </tr>
    </table>
    </template>
<script setup lang="ts">
import axios from 'axios';
import {ref}from'vue'
const info=ref({
    Uname:'',
    Upwd:''
})
const Ulogin=()=>{
    axios.get("https://localhost:44324/api/Lx/Ulogin",
        {
            params:{
                Uname:info.value.Uname,
                Upwd:info.value.Upwd
            }
            }
        ).then(res=>{
            if(res.data==-1){
                alert("密码错误")
                return
            }
            else if(res.data==-2){
                alert("用户名不存在")
            }else if(res.data>0){
                alert("登录成功")
            }else{
                alert("登陆失败")
            }
        })
    }
    

</script>

